package config;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.beans.PropertyVetoException;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * Created by guo on 2017/9/17.
 */
public class C3P0Untils {
private static ComboPooledDataSource source=null;
static {
    source=new ComboPooledDataSource();
        try {
            source.setDriverClass("com.mysql.jdbc.Driver");
            source.setJdbcUrl("jdbc:mysql://localhost:3306/jdbc");
            source.setUser("root");
            source.setPassword("root");
            source.setMaxPoolSize(15);
            source.setMinPoolSize(5);
        } catch (PropertyVetoException e) {
            e.printStackTrace();
        }
}
    public static Connection getConnettion() throws SQLException {
        return source.getConnection();
    }
}
